
export default function fetchRequest(url: string, options: any) {
    let appKey = ''
    // const baseURL = import.meta.env.VITE_APP_BASE_API;
    // let requestUrl = baseURL + url;
    let selectedModel = localStorage.getItem('selectedModel')
    if (selectedModel) {
        try {
            const selectedModelJSON = JSON.parse(selectedModel);
            appKey = selectedModelJSON.secretKey
        } catch (error) {
          console.error('localStorage 数据格式错误');
        }
        
    }
    const headers = {
        "Content-Type": "application/json",
        Authorization: `Bearer ${appKey}`,
    }
    options.headers = {
        ...headers,
        ...options.headers,
    };
    return fetch(url, options);
}
